using System.Linq;
using UnityEngine;
using UnityEngine.UI;

namespace MaterialUI
{
	public class DividerInstantiationHelper : InstantiationHelper
	{
		public const int optionLight = 0;

		public const int optionVertical = 1;

		[SerializeField]
		private LayoutElement m_LayoutElement;

		[SerializeField]
		private Image m_Image;

		public override void HelpInstantiate(int[] options)
		{
			if (options.Contains(0))
			{
				m_Image.color = MaterialColor.dividerLight;
			}
			if (options.Contains(1))
			{
				m_LayoutElement.minHeight = -1f;
				m_LayoutElement.minWidth = 1f;
				m_Image.rectTransform.anchorMin = new Vector2(0.5f, 0f);
				m_Image.rectTransform.anchorMax = new Vector2(0.5f, 1f);
				m_Image.rectTransform.anchoredPosition = new Vector2(0f, 0f);
				m_Image.rectTransform.sizeDelta = new Vector2(1f, 0f);
			}
			else
			{
				m_Image.rectTransform.anchoredPosition = new Vector2(0f, 0f);
				m_Image.rectTransform.sizeDelta = new Vector2(0f, 1f);
			}
			base.HelpInstantiate(options);
		}
	}
}
